import request from '@/utils/request'
import {Message } from 'element-ui'
import { error } from 'util'

// 获取代理池list
export function getProxiesList(data, succCb) {
  return request({
    url: 'proxies/',
    method: 'get',
    params: data
  }).then(res => {
    succCb(res)
  }).catch(() => {
    console.log('getProxiesList-->>')
  })
}

// 代理详情
export function proxieDetail(id, succCb) {
  return request({
    url: 'proxies/' + id,
    method: 'get'
  }).then(res => {
    succCb(res)
  }).catch(() => {
    console.log('proxieDetail-->>')
  })
}

// 添加代理
export function addProxie(data, succCb) {
  return request({
    url: 'proxies/',
    method: 'post',
    data
  }).then(res => {
    succCb(res)
  }).catch(() => {
    console.log('addProxie-->>')
  })
}

// 更新代理
export function updateProxie(id, data, succCb) {
  return request({
    url: 'proxies/' + id,
    method: 'put',
    data
  }).then(res => {
    succCb(res)
  }).catch(() => {
    console.log('updateProxie-->>')
  })
}

// 删除用户
export function delProxie(id, succCb) {
  return request({
    url: 'proxies/' + id,
    method: 'delete'
  }).then(res => {
    succCb(res)
  }).catch(() => {
    console.log('delProxie-->>')
  })
}